var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
(function (factory) {
    if (typeof module === "object" && typeof module.exports === "object") {
        var v = factory(require, exports);
        if (v !== undefined) module.exports = v;
    }
    else if (typeof define === "function" && define.amd) {
        define(["require", "exports", "react", "components/common/component", "components/common/base-component", "mobile/services/memberService", "maishu-services-sdk", "maishu-ui-toolkit"], factory);
    }
})(function (require, exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    const React = require("react");
    const component_1 = require("components/common/component");
    const base_component_1 = require("components/common/base-component");
    const memberService_1 = require("mobile/services/memberService");
    const maishu_services_sdk_1 = require("maishu-services-sdk");
    const maishu_ui_toolkit_1 = require("maishu-ui-toolkit");
    let SummaryHeader = class SummaryHeader extends base_component_1.BaseComponent {
        constructor(props) {
            super(props);
            this.memberService = this.createService(memberService_1.MemberService);
            this.imageService = this.createService(maishu_services_sdk_1.ImageService);
            this.memberService.store().then(store => {
                this.setState({ store });
            });
        }
        render() {
            if (!this.state) {
                return null;
            }
            let { store } = this.state;
            store = store || {};
            let src;
            if (store.ImagePath) {
                src = this.imageService.imageSource(store.ImagePath, 100, 100);
            }
            else {
                src = maishu_ui_toolkit_1.generateImageBase64(100, 100, store.Name || "");
            }
            return React.createElement("div", { className: "summaryHeader-control" },
                React.createElement("div", { key: 10, className: "headerImage pull-left" },
                    React.createElement("img", { src: src, ref: (e) => e ? maishu_ui_toolkit_1.renderImage(e, { imageSize: { width: 100, height: 100 } }) : null })),
                React.createElement("div", { key: 20, className: "headerContent" },
                    React.createElement("h4", { className: "title" }, store.Name),
                    React.createElement("div", { className: "item" },
                        React.createElement("div", { className: "number" }, "0"),
                        React.createElement("div", { className: "text" }, "\u5168\u90E8\u5546\u54C1")),
                    React.createElement("div", { className: "item" },
                        React.createElement("div", { className: "number" }, "0"),
                        React.createElement("div", { className: "text" }, "\u4E0A\u65B0\u5546\u54C1")),
                    React.createElement("div", { className: "item", onClick: () => this.props.app.forward("shopping/orderList") },
                        React.createElement("div", { className: "number" },
                            React.createElement("i", { className: "icon-user" })),
                        React.createElement("div", { className: "text" }, "\u6211\u7684\u8BA2\u5355")),
                    React.createElement("div", { className: "clearfix" })));
        }
    };
    SummaryHeader = __decorate([
        component_1.component({
            displayName: "店铺信息", icon: "icon-edit",
            introduce: "显示店铺相关信息，包括店铺图标，店铺名称，商品数量，订单数量等等，一般放置在首页顶部。"
        })
    ], SummaryHeader);
    exports.SummaryHeader = SummaryHeader;
});
